package com.jingxi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jingxi.common.pojo.EasyUIDataGridResult;
import com.jingxi.common.pojo.JingXiResult;
import com.jingxi.model.TbContent;
import com.jingxi.service.ContentService;

@Controller
public class ContentControler {
	
	@Autowired
	private ContentService ContentService;
	
	@RequestMapping("/content/query/list")
	@ResponseBody
	public EasyUIDataGridResult getContentList(long categoryId,int page,int rows) {
		return ContentService.getContentWithCatId(categoryId, page, rows);
	}
	
	@RequestMapping("/content/save")
	@ResponseBody
	public JingXiResult saveContent(TbContent tbContent) {
		return ContentService.saveContent(tbContent);
	}
	

	@RequestMapping("rest/content/edit")
	@ResponseBody
	public JingXiResult editContent(TbContent tbContent) {
		return ContentService.editContent(tbContent);
	}
	
	@RequestMapping("/content/delete")
	@ResponseBody
	public JingXiResult contentDelete(long[] ids) {
		return ContentService.deleteContent(ids);
	}
}
